<template>
	<view class="page">
		<view
			style="box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2);padding: 20px;background-color: white;text-align: center;">
			<image :src="data.icon" style="width: 70px;height: 70px;"></image>
			<p style="margin-top: 5px;font-size: 18px;">{{data.title}}</p>
			<p style="margin-top: 3px;font-size: 14px;color: #757575;">{{data.version}}</p>
			<p style="margin-top: 3px;font-size: 14px;color: #757575;">{{data.size}}/{{data.down}}次下载/简体中文</p>
			<button @click="down(data._id)"
				style="line-height: 35px;color: white;background-color: #4CAF50;width: 120px;margin-top: 10px;font-size: 14px;">下载Apk</button>
		</view>
		<view
			style="background-color: white;padding: 20px;margin-top: 20px;box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);">
			<p v-if="data.image.length>0" style="color: #4CAF50;">应用截图</p>
			<scroll-view v-if="data.image.length>0" class="scroll-view_H" scroll-x="true" style="margin: 10px 0;">
				<image @click="openImg(data.image,index)" v-for="(item,index) in data.image"
					style="width: 150px;border-radius: 5px;margin: 10px 5px;" mode="widthFix" :src="item">
				</image>
			</scroll-view>
			<p v-if="data.content!=null" style="color: #4CAF50;">应用简介</p>
			<view v-if="data.content!=null&&data.content!=''" style="margin: 10px 0;font-size: 14px;">
				<rich-text selectable :nodes="data.content"></rich-text>
			</view>
			<p style="color: #4CAF50;">其他信息</p>
			<ul style="list-style: none;margin-top: 10px;font-size: 14px;padding: 0;">
				<li>应用包名：{{data.package}}</li>
				<li>发布日期：{{$u.timeFrom(new Date(data.time).getTime(),false)}}</li>
			</ul>
		</view>
		<view
			style="background-color: #333;padding: 20px 0;color: white;font-size: 12px;display: flex;justify-content: center;">
			<p>Copyight ©2017-2023</p>
			<a style="margin: 0 5px;color: white;" href="https://www.x2.ink">小二云盘</a>
			<p>All Rights Reserved.</p>
		</view>
	</view>
</template>

<script>
	import ase from '@/common/ar-aes/ar-aes.js'
	export default {
		name: "apk_md",
		props: {
			data: {
				type: Object,
				default (data) {
					return {}
				}
			}
		},
		methods: {
			report(id, title) {
				uni.navigateTo({
					url: '../feedback/feedback?id=' + id + '&type=file'
				});
			},
			down(id) {
				this.$emit("down", {
					id: id
				})
			}
		}
	}
</script>

<style lang="less">
	.page {
		background-color: #eeeeee;
	}

	.scroll-view_H {
		white-space: nowrap;
		width: 100%;
	}
</style>